package com.zcyh.exam.job.quartz;

import com.zcyh.exam.constants.EnumConstants;
import com.zcyh.exam.job.quartz.config.quartz.QuartzJob;
import com.zcyh.exam.model.entity.ExamInfo;
import com.zcyh.exam.service.education.ExamInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * 自动交卷
 * @author timo
 */
@Service("examAutoCommitScheduler")
public class ExamAutoCommitScheduler implements QuartzJob {

	@Autowired
	private ExamInfoService examInfoService;

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void execute(Map<?, ?> args) throws Exception {
		String examInfoId = (String) args.get("examInfoId");
		examInfoService.commitTestPaperInfo(examInfoId);
	}

}
